package njust.edu.web;


import njust.edu.entity.Dish;
//购物车中的一项
public class CartItem {
    private Dish dish;
    private Integer quantity;

    //构造函数 菜品份数为1
    public CartItem(Dish dish) {
        this.dish = dish;
        this.quantity = 1;
    }

    public Dish getDish() {
        return dish;
    }

    public void setDish(Dish dish) {
        this.dish = dish;
    }

    public Integer getQuantity() {
        return quantity;
    }

    public void setQuantity(Integer quantity) {
        this.quantity = quantity;
    }

    //本项金额
    public float getMoney() {
        return dish.getPrice() * quantity;
    }

    //份数加一
    public void add() {
        quantity++;
    }

    public void minus(){
        quantity--;
    }

}
